1. Field of the Invention
The present invention relates to an image processing apparatus, image processing method, and computer-readable medium which correct a color balance of input digital image data.
2. Description of the Related Art
Conventionally, a method of estimating a light source at the time of shooting of image data shot by a digital camera or that obtained by optically scanning a film shot by an analog camera, and applying a color balance correction to the image data has been proposed.
Japanese Patent Laid-Open No. 2002-152772 describes the following method. That is, a blackbody locus of gray and human skin color pixels based on a representative spectral distribution of a camera is held in advance. RGB components of respective pixels are multiplied by various coefficients so as to attain inverse conversions of a color balance correction of a camera, and the number of pixels after conversion, which are located adjacent to the blackbody locus, is evaluated, thereby estimating a light source at the time of shooting. After the light source is estimated, the converted image is converted into colors under a predetermined light source.
The aforementioned color balance correction method suffers the following problem. That is, image data shot by digital cameras and those obtained by optically scanning films shot by analog cameras include a wide variety of image data, and a gray region and skin color region may be erroneously detected. For example, assuming a portrait photo of a person who holds a yellow flower bouquet in image data, a skin color can be correctly detected by human face detection, but a yellow flower region may often be erroneously detected as a highlight color. In this case, since a gray region in an image is erroneously detected, an estimation error occurs with a high possibility upon estimation of a light source at the time of shooting.
On the other hand, in face detection upon analyzing image data, for example, if a mountain surface in a landscape photo is erroneously detected as a face, a skin color is erroneously detected. In this case, a highlight color can be correctly estimated, but a light source at the time of shooting is erroneously estimated with a high possibility due to erroneous detection of the skin color.
When the color balance correction is applied using the above light source estimation value, a color balance of image data is largely broken, thus causing image adverse effects.